<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>3-foreach遍历数组</title>
</head>

<body>
    <script>
        var arr = ["xx", "cc", "mm"]
        //第一种方法遍历数组
        // for (var i = 0; i < arr.length; i++) {
        //     console.log(arr[i])
        // }
        //第二种
        arr.forEach(function (item, index) {
            console.log(item, index)
        })

    </script>
</body>

</html>